const mysql = require("mysql")

var connection = mysql.createConnection({
    host: 'localhost',
    user: 'root', //连接名
   password: '123456',
    database: 'root'//数据库
});

// 启动mysql,并连接到数据库
connection.connect((err,arr)=>{
    console.log("连接成功");
});

function dbQuery(sql,result){
    connection.query(sql,result);
}

module.exports = {connection,dbQuery}